#!/bin/bash

# 设置项目名称
PROJECT="polaris-provider"
LINUX_OUTPUT="bin/linux/${PROJECT}"
WINDOWS_OUTPUT="bin/windows/${PROJECT}.exe"

# 创建输出目录
mkdir -p bin/linux bin/windows

# 构建 Linux 版本
echo "Building Linux version..."
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o ${LINUX_OUTPUT} main.go

# 构建 Windows 版本
echo "Building Windows version..."
GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 \
    go build -ldflags "-s -w" -o ${WINDOWS_OUTPUT} main.go

# 检查构建结果
echo -e "\nBuild complete:"
file ${LINUX_OUTPUT}
file ${WINDOWS_OUTPUT}
